transcribing minor revisions suggested by @jonathaneisen