provide the new calculation for rank along with a test