refactoring page load initialization