Clean up enum mappings and add some bounds checking assertions