Working with bag of words