Changed "end" command using copies variable, not hardcoded