minor tweaks and refactorings