Refactor loading of HDF5 library