corrected rank to rank_by_amount