searchWord function complete