more refactoring fixes