Refactor and phantoms addition

Refactored several pieces of code to simplify the implementation.
BREAKING CHANGE - changed several API calls: send to emit, receiver to
register, remove to unregister.
Added phantomjs to the unit testing process and updated the travis yml
to property run the new tests.