Add more generic 2D/3D code.