several more refactorings & modifications