Minor clean-up and refactorings