Implementation of the FIND algorithm