Replaced prints with logging
Improved logging and added count thresholds
Moved logger instantiation