updated cant algorthim