Moved everything to controller. Improved performance.