added database logging