Created new macro render_title to remove duplicate code.
Removed more duplicate code.