Cleaned up maincontroller to incorp facotry into findPet function