cleanup and remove debug code