Continued refactor and rewrite of the window events.