fucntion validWord modified