working on refactoring