first stage preparation for multithreading