Made the cube mode handle reference shapes that have differing dimensions.