Finally remove all malloc()'s from the substitute code. Now totally