Refactoring, cleanup, misc updates.
Merge remote-tracking branch 'origin/master'