example code tidy up