Please consider refactoring the: cube creation, y coord creation, saving and loading into a common function.