refactor patch to minimize changes