working copy of refactor