Adding ASSERT macro, "leave_session" and decent-er cleanup.