refactor code placements