Wrapping patching process to function