Ported EdgeReorderer and fixed related code