Added magically improved percentile rank code