Simplified directive. Fixed problem when multiple flags were inserted in the html