Refactor module.js
Tweak code for more readable
Refactor lots of code
Improve code logic for compile method