Styled some more and cleaned up the code a little, taking the logic out of the controller and putting it into a service class.