Implemented the hook system for the Session class.

Any class can now register a callback for any hook in the Session class.