Modularized the whole js

* Add broken to different logical blocks.