added debugging printfs