Added random search optimization