revisions by @paf31