made progres on pds.cpp and made lots of small fixes