Refactor title displaying