[issue#1] store and restore state when application is interrupted