Improved title logic