First implementation of the search