working on refactor