finished basic lattice functionality