Fixed. If the array_search returns false, it will just append to the end.