Added window.onload = main