added ability to output data as list in addition to data.frame