refactored and added wordcount vector calculation