Various checks for when app state changes