Nicholas J. Humfrey <njh@aelius.com>

With help and code from Steve Harris <steve@plugin.org.uk>
