Added window event listeners