tidying up and logging more