added validation to mode