some more refactoring. getting closer