A bunch of changes - see commits

@markguinn - sorry these are not split up, I just wanted to share the changes with you.