Refactoring page rendering logic. Enhanced header widget.