added validation for unique code