Progresses commit: functional refactor.

TODO: clean up dead code, move modules.
Remove dead code, tweak apis.
Sigular formatter.