remove unused code
save and restore the state of app when it's killed by system
refactor code