working on refactoring pieces