Better enum range check.  Refactor.