Tidy up, based on comments from @pickle27.