Converted debug prints to use python logging module