Refactoring query related classes...
Removed some unused files.
Fixed memory leak error.
Cleaned up a little.