Replace complicated and currently broken manual alignment code by