Moved some function to include files.
Moved parse query to the class.