begin refactor