added database recording functionality