more refactorings, more object-oriented logic