Some factoring, including putting all of the time consuming bits on a new thread, to take less stress on the UI thread.