Made everything work

Persistance is now fully implemented and it no longer crashes when
a session is closed or ctr+shft+r refreshed.