Misc cleanup/refactor