Move thread switching to application project