So funktioniert der AMS-Algorithmus