Adds session states.

You can save/load sessions with the core saveSession and loadSession
May be buggy right now.
Report every bug you find, please.