Fix up querying code and build out handling results