replaced prints with logging