putting the house in order. small refactorings.