Rename local to var
Some modifications