added ranking code