half code for subdivisions and bezier