added validation for database entry