Changed debug prints into calls to python logging module