Added enumeration and refactoring