build the session structure