Refactor to allow multiple listeners

Also, adds an example CLIHandler. 

@bruslim: Some of the work you've done will conflict with this.  Would you mind reviewing this PR and see if it makes sense to rebase your changes on top of this?  Or we could get your PR merged in first, and I can rebase later.