Continue refactoring. Change 'print' to log.