Search algorithm slightly improved and corrected.