Change TextMap to WordMap
Fix index variables