First search implementation