first version of a directive and cleanup