Complete re-write.