added database operations to routes