added validation rules and updated SQL structure