add some print statements to pinpoint slowness.