adds a decent marginPercentRank function (untested)