Added git patching, as well as a bunch of fixes and cleanups