hdf5: refactoring