Better logging and clean up class scope.