Removing globals and fixing verbose logging