More hacking about. Large messy commit