Refactoring Cube methods into cube.js