ported thread mechanics, totally untested