Add and remove multiple blocks of code based on predefined template.