added location filtering code to existing