Moved all logic into a service and created a child route directive for mainpage