Changed the scope of the functions with "window.".