move lattice generation to separate object