Tidy up before merge. Add comments.