Refactored render_content() method