Added session storing and restoring