made some functions in the Lattice class branchless