apply James Bayer's edits