adding rootScope to controller
clean up frontend JS