a few more refactoring