Replace var as appropriate