code tidy from peer review