Handle application state and settings