Restructuring for any future porting (moved 3d specific code to mobius)