beginning refactor