Started some refactoring.