debugged xrank, yrank. More to debug