Lots of changes, now in squashed format