added database control