split code between ui and worker threads, fixed up some of the failing tests