copied cubeinitialization