added close curve option