Algorithm for object