Minor refactoring in ElementHelper.