Did some sweet refactoring.