adding initial code for portalable multithreading