Finished Query Builder Wizard.

Finished Query Builder Wizard and major refactoring.