Fixed notation in pd algo. Some minor changes