src: Made modifications to the lattice functions and added lot of debugging statements.