Added a variable that stores the number of locations