Better logging, tidying.