Added enumerator, some refactoring