Fix end alignment

This is my solution for #338.

For discussion and contrasting with @edzhelyov's ideas about alternative solutions.