cleaned up 3d location code.