replace print statement with log.warn, add some debug statements