fixed how thread name is found, wrote basic tests