added input validation to operators