updated for dataframe output