Minor refactoring of page load