modified to sort by activity_ID