Made model work more like a model, less like a controller