Minor refactoring according to PR review.