make lightcurve loading code more generic