working version where the cube's digonal size is the min_ll, but still needs to be optimized more