separate functions from routes