refactor patches