implement all routes and function bodies for api calls