public version of my modifications to http://www.leonerd.org.uk/code/circle/obtain.html