revised worddetector, tried one junit test