Add kill option to thread.
Put all calculations in a worker thread.