test clean up
move directive common functions out of linking function