Minor architectural changes to js controller