This function replaces the 3 patches applied before