window refactor / events