modifying function for summary table