changed word lookup logic