tidied up logging