implementing and testing doctoccing