added word matrix code