basic implementation of PWD