changed implementation of LatticeNode + other small changes