Remove duplicate code and make it support the new dataset loading fct.