added primitive thread supervision code