Feature lattice2

I have addressed the issues. Can you all take another look.Thanks.
I think @itziakos is refering to 
```
#end if 
```