some 3D code refactorings