Main class refactored.