Commented code to write to window and added onload