Added comments into handleInput method