Wide range of changes. Adding Win32 event handling.