finished merging setVariable function