refactored PSVN handling (sorta). also sketch of new, better database checking code after __END_.
Changed paths: