The AM routine

The PM routine