refactor complete; pre-testing