I've probably got some bits wrong but there were details I had to guess. Still makes some sense.
http://blogs.cjb.net/btlmaster/94358/