add test and remove debug code