improve sort function to sort by total goals and then organize by teams