refactoring page setup