Moved some functions to make the logic more logic

Now with a function within a model
changed the method routes are set up