moved a bunch of stuff from factory to controller to render