Changed debug logging to use logging module and made a few methods private