Added enums and did some refactoring