Sped up elev2stroke2 function