migrate to thread system