added database functionality