Added new behavior to code.
Seperated Listener from Main and added count variable