Refactored. Added note about mocking user input