major revision in tinyG_thread.py