minor refactoring & code aesthetic tweaks