First version by Nick Lambert, transferred into tex