Better solution to LeaderBoard algorithm