Fixing 3d code

It works now!