Replaced prints with logging