Adding logging for easier troubleshooting