Added preliminary work on automatic patching