Did some more refactorings