added torus code