simplified cube.js code