Applies two patches. Check comments for details.