Rob partial refactoring
More minor tweaks