refactored code and made application more event driven
added helper (space key) to simulate user events