Added query options and reset function.
Re-planning when memory estimate exceeds limit.