more refactoring for having smaller methods