Change emperor.js to make it cleaner

Add some documentation that will be clearer on the long run and removed
unuseful console.log statements as well as dead code.

Fix #150