added exit on invalid input