replaced prints by debug prints