replaced prints with logs