1) fixed some threading issues
2) removed debugging output
3) added some test cases