Refactor title and its tests