add location query and abstract the class for querying data