The code works up to hdf5save function.