sessions library done (barely tested)