Implemented valid word method