some more refactorations