replaced prints with logs.