code cleanup for pth