inserted printfs for debugging