Updated semi-working lattice code.