Refactored page rendering