Refactoring

@stefanpenner done.