tidy up and commenting