enhanced circling algorithm