wip on error handling and hdf5 output