Re-added query history; clean up