Wrote the init() function, and called it after the window has loaded.