Some classes and methods refactored.