improve the directive api