removed some debug prints
added logging