Reorder error checking

- Only call .toLowerCase once on definition