Array search function improved, errors solved.