The initial push got things going, now I've neatened everything up and the logging stuff is done in a single line.