Styling: removed some unnecessary scoping, refactored some scoping