Some refactoring with enum