made window callback an event listener