added code to lazily construct the curve tree