moving more code from the 2D and the 3D to the common parent class