revised to fix wd