re implementing mquery sort, skip, limit logic