Massive refactoring.

* Use TypeScript internal module.
* Extract data related stuffs to one file.
* Rename module files.
Fix waterfall script dependencies.