added database insertion