Add logging to nearly everything and make it more consistent