Refactors main class