Did some more refactoring