Lots of changes, next commit will have full details.