Began refactoring