refactor cube creation logic.