The distanceToOrigin() method was fine, I was just calling it incorrectly on line 58