More work and refactoring.