refactor the relevant implementation