Added save/restore state functions, demo project stores settings via NSUserDefaults