Changed search and add validation to .length