Stuck at how to sort a map by value. Perhaps there's a better way to do all of this.