attached algorithm