Updated factory and added more logic for home page in controller