Cleanup enum handling and code duplication.

This removes unneeded code duplication and cleans up enum handling:
 * all-in-one-line declarations
 * doing nothing when an unhandled enum value is encountered
 * inconsistent indenting