Stop some memory leaks. Fix duplicate initializations