Ongoing heavy refactoring.