more JS reorganizations + bug fixes
Pull from Vdhawal.

Merge branch 'master' of https://github.com/saumishr/apps