add more tests and remove debug code