Improve ranking algorithm