Lots of work on master node cleanup