changed many instances of $varname to "${varname}"