Refactored layout and title generation