Spacing tweaks and refactoring