added functions to models, added functions and route functionality