added print statements to see why code stops in funcdef