finished code to preserve checkbox state with device rotation