removed old code

+ refactored the listener code,
+ removed old methods
+ updated example