Rename vars in a smart way