Logging tweaks and better lifecycle hooks