added AKS algorithm proper