Final with changes for shared preference persistence