Set scope of functions as public and corrected SQL strings