Add unit test for directive and minor changes