new version of refactor