Add better logging as well as touch up our query upgrade