You can use 'elseif' instead of 'else if' at the on :input: part. And I don't believe there is need for a HALT every time.