Changed prints with logging.
Changed prints with logging. Fixed minor bug.