Reorganized the order of the methods and other refactorings