Removing needless copying of variables which should be global anyway