Clean up logging and add additional debug statements