now doing query on DB instead pulling all locations and filtering then