Performance issues repaired

Performance issues repaired, started working on lattice comparison