Added logic and test for returning ties in #most_frequent and #most_expensive_total