Refactor target proposal code