Methods of optimal alignment