Removed bugged git stuff and fixed memory leaks

GIT bugged last time a bit, this ought to have fixed it.