Major overhaul and refactoring.