added edge reordering based on adjacent cell order