Refactor the cube itself into a class.