changed logging
some tidying