refactor begin