Make pddet more readable by splitting and refactoring (a little)
Fix compiler warnings when crosscompiling.