Cleaning up some logging and logic to be simpler.