distance is stored as a var for efficiency