adapted to the NEWT thread model