Changed functions to be declared in the stage before the stage of their declared variable.