Some cleanup and fixes.
Merge remote-tracking branch 'mpmaster/master'