refactored hdf5 io