added database and logging