Add generated directive and cleanup