Move non-UI concerns out of the main controller

and into services