improved calc of top k percentage