proto ordering code