Replaced all the print statements with log statements. I hope some won't be called too often though.