Refactor code to prepare for callbacks
Merge branch 'dev' of https://github.com/bitstatic/listen2 into dev