Enum logic, bug fixing