replaced quantile by percentile, added docstrings