WIP: better organization of angularjs code.