reformat code and add description for external defense tab