Updated patch to unified diff and improved it.