Changed cout and cerr to log.debug() and log.error()