Updated the param values in some of the jsdoc and test if an value is a string before checking its value in the contains dictionary function
Moved the optimization code to the bottom of the file
Pass the result of the compileQuery function through the optimization as well. This ensure that the simplest operations are put up front, so the optimized output is actually faster in more cases.