Did some small refactoring