working refactor.