Some more stuff. Preliminary, sort of working code