Added logging option for testing.