Refactor page title helper