Refactored location query

all specs passing