Changed debug output to use logging module