Refactor title helper