Refactored title handling