The instance and session objects are now C++ structs. The next pointers for the sessions was removed as it is not the appropriate place to store this information. This means that the client notification functionality is broken in this commit.
Removed commented out code, manual revision notes and extraneous comments.
Minimal changes, only what is needed in order to make it compile.