getRecords method: query improved