Updated code to dynamically generate subsections.