Some minor refactoring as result of code review.