Did some small refactoring. More to come.