Made some more refactorings