see http://www.reddit.com/r/GoForGold/comments/28rmod/make_a_sorter_like_this_one/