Refactored wordcloud directive