Working on the cleaned up query system.