Tidy up indent
Move auto save to main thread.
Move afk state check to main thread.