fixed an oops and replaced LatticeSize() with var cubeSize