Made Delete*() routines more robust
Changes to OutputLatticeState()
Add arguments, make variables local