first round of refactoring: hdf5 read/write