Rewriting some code to NOT use malloc as this can be dangerous. Substituted a DataArray<float> object which will always clean up the memory