Changed main's structure

Moved around the if and else statements to appropriately handle bad
input.