Major revisions to get the bloody thing working