Order preserving implementatation

Doesn't yet put each guard on its on line.