Use self.stdout instead of print