Replaced many rm, gunzip and sed calls with patches.