Understanding variables references and assignment