converted to logging
tidying