improved IO, PDB parsing, refactor