Ordering and epoch generation code