Changed session handling and initialization. Updated examples accordingly.