window.onload added to main.js file