Major bug fix in calculating closest location