Refactor listeners. 

This pull request fixes #14