added subdivide code