remove unneccessary code
lock os threads
removed unused func