Cleaned up imports
Must copy query history on load from saved preferences.

Fixes #7