more refactoring for clarity