New calculate_day_rank, the vectorisation needs testing
Moved the calculations outside of the return statement