Did some minor refactoring