refactored enum conversion and cleaned up