Adds automation flipping.

Implements #1289.