Added checks for invalid locations and accuracy.