Last method was no good, adding code back into the record_query method