Tidy up and correct errors.