Made xw not global anymore.