pass variables by reference and copy