Added comments, added row_avg function