Index: src/Parser/PdbAtomInfoContainer.cpp
===================================================================
--- src/Parser/PdbAtomInfoContainer.cpp	(revision 24f1282e1df2c72138841c78643facb494f0b9ed)
+++ src/Parser/PdbAtomInfoContainer.cpp	(revision 16462f8c5b097f56fd1c2c03e31b5cd9daef6a0f)
@@ -24,11 +24,13 @@
 #include "Helpers/toString.hpp"
 //#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
 #include "PdbAtomInfoContainer.hpp"
 
 
 PdbAtomInfoContainer::PdbAtomInfoContainer() :
+  token("ATOM"),
   serial(0),
   name("-"),
-  altloc('0'),
+  altLoc('0'),
   resName("-"),
   chainID('0'),
@@ -37,4 +39,5 @@
   occupancy(0.),
   tempFactor(0.),
+  element(""),
   charge(0)
 {}
@@ -46,4 +49,7 @@
 {
   switch (key) {
+    case PdbKey::token :
+      ScanKey(token, value);
+      break;
     case PdbKey::serial :
       ScanKey(serial, value);
@@ -52,6 +58,6 @@
       ScanKey(name, value);
       break;
-    case PdbKey::altloc :
-      ScanKey(altloc, value);
+    case PdbKey::altLoc :
+      ScanKey(altLoc, value);
       break;
     case PdbKey::resName :
@@ -67,4 +73,13 @@
       ScanKey(iCode, value);
       break;
+    case PdbKey::X :
+      ScanKey(XYZ[0], value);
+      break;
+    case PdbKey::Y :
+      ScanKey(XYZ[1], value);
+      break;
+    case PdbKey::Z :
+      ScanKey(XYZ[2], value);
+      break;
     case PdbKey::occupancy :
       ScanKey(occupancy, value);
@@ -72,4 +87,7 @@
     case PdbKey::tempFactor :
       ScanKey(tempFactor, value);
+      break;
+    case PdbKey::element :
+      ScanKey(element, value);
       break;
     case PdbKey::charge :
@@ -82,13 +100,16 @@
 }
 
-std::string PdbAtomInfoContainer::get(const PdbKey::PdbDataKey key) const
+template <>
+std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const
 {
   switch (key) {
+    case PdbKey::token :
+      return toString(token);
     case PdbKey::serial :
       return toString(serial);
     case PdbKey::name :
       return toString(name);
-    case PdbKey::altloc :
-      return toString(altloc);
+    case PdbKey::altLoc :
+      return toString(altLoc);
     case PdbKey::resName :
       return toString(resName);
@@ -99,8 +120,16 @@
     case PdbKey::iCode :
       return toString(iCode);
+    case PdbKey::X :
+      return toString(XYZ[0]);
+    case PdbKey::Y :
+      return toString(XYZ[1]);
+    case PdbKey::Z :
+      return toString(XYZ[2]);
     case PdbKey::occupancy :
       return toString(occupancy);
     case PdbKey::tempFactor :
       return toString(tempFactor);
+    case PdbKey::element :
+      return toString(element);
     case PdbKey::charge :
       return toString(charge);
@@ -111,2 +140,37 @@
 }
 
+template <>
+int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const
+{
+  switch (key) {
+    case PdbKey::serial :
+      return serial;
+    case PdbKey::resSeq :
+      return resSeq;
+    case PdbKey::charge :
+      return charge;
+    default :
+      std::cout << "Unknown key or not presentable as int: " << key << std::endl;
+      return 0;
+  }
+}
+
+template <>
+double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const
+{
+  switch (key) {
+    case PdbKey::X :
+      return XYZ[0];
+    case PdbKey::Y :
+      return XYZ[1];
+    case PdbKey::Z :
+      return XYZ[2];
+    case PdbKey::occupancy :
+      return occupancy;
+    case PdbKey::tempFactor :
+      return tempFactor;
+    default :
+      std::cout << "Unknown key or not presentable as double: " << key << std::endl;
+      return 0.;
+  }
+}
Index: src/Parser/PdbAtomInfoContainer.hpp
===================================================================
--- src/Parser/PdbAtomInfoContainer.hpp	(revision 24f1282e1df2c72138841c78643facb494f0b9ed)
+++ src/Parser/PdbAtomInfoContainer.hpp	(revision 16462f8c5b097f56fd1c2c03e31b5cd9daef6a0f)
@@ -11,5 +11,8 @@
 #include "PdbKey.hpp"
 
+class Vector;
+
 #include <string>
+#include <typeinfo>
 
 /**
@@ -22,5 +25,12 @@
 
   // getter and setter
-  std::string get(const PdbKey::PdbDataKey key) const;
+  template <class T> T get(const PdbKey::PdbDataKey key) const  {
+    switch (key) {
+      default :
+        std::cout << "Unknown key or not representable as " << typeid(T).name() << ": " << key << std::endl;
+        break;
+    }
+    return (T)NULL;
+  }
   void set(const PdbKey::PdbDataKey key, std::string value);
 
@@ -46,15 +56,25 @@
 
 private:
+  std::string token;
   int serial;
   std::string name;
-  char altloc;
+  char altLoc;
   std::string resName;
   char chainID;
   int resSeq;
   char iCode;
+  Vector XYZ;
   float occupancy;
   float tempFactor;
+  std::string element;
   int charge;
 };
 
+template <>
+std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const;
+template <>
+int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const;
+template <>
+double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const;
+
 #endif /* PDBATOMINFOCONTAINER_HPP_ */
Index: src/Parser/PdbKey.hpp
===================================================================
--- src/Parser/PdbKey.hpp	(revision 24f1282e1df2c72138841c78643facb494f0b9ed)
+++ src/Parser/PdbKey.hpp	(revision 16462f8c5b097f56fd1c2c03e31b5cd9daef6a0f)
@@ -18,13 +18,18 @@
   enum PdbDataKey {
     noKey,
+    token,
     serial,
     name,
-    altloc,
+    altLoc,
     resName,
     chainID,
     resSeq,
     iCode,
+    X,
+    Y,
+    Z,
     occupancy,
     tempFactor,
+    element,
     charge
   };
Index: src/Parser/PdbParser.cpp
===================================================================
--- src/Parser/PdbParser.cpp	(revision 24f1282e1df2c72138841c78643facb494f0b9ed)
+++ src/Parser/PdbParser.cpp	(revision 16462f8c5b097f56fd1c2c03e31b5cd9daef6a0f)
@@ -46,4 +46,5 @@
 PdbParser::PdbParser() {
   knownTokens["ATOM"] = PdbKey::Atom;
+  knownTokens["HETATM"] = PdbKey::Atom;
   knownTokens["TER"] = PdbKey::Filler;
   knownTokens["END"] = PdbKey::EndOfFile;
@@ -51,4 +52,9 @@
   knownTokens["REMARK"] = PdbKey::Remark;
   knownTokens[""] = PdbKey::EndOfFile;
+
+  // argh, why can't just PdbKey::X+(size_t)i
+  PositionEnumMap[0] = PdbKey::X;
+  PositionEnumMap[1] = PdbKey::Y;
+  PositionEnumMap[2] = PdbKey::Z;
 }
 
@@ -99,4 +105,7 @@
   size_t linecount  = 0;
   enum PdbKey::KnownTokens token;
+
+  // reset atomIdMap for this file (to correctly parse CONECT entries)
+  atomIdMap.clear();
 
   molecule *newmol = World::getInstance().createMolecule();
@@ -157,29 +166,68 @@
   }
 
-  // we distribute new atom numbers, hence clear map beforehand
+  // we distribute serials, hence clear map beforehand
   atomIdMap.clear();
   {
-    vector<atom *> AtomList = World::getInstance().getAllAtoms();
-
-    std::vector<int> elementNo(MAX_ELEMENTS,1);
+    std::vector<atom *> AtomList = World::getInstance().getAllAtoms();
+    std::vector<molecule *> MolList = World::getInstance().getAllMolecules();
+    std::map<size_t,size_t> MolIdMap;
+    size_t MolNo = 1;  // residue number starts at 1 in pdb
+    for (std::vector<molecule *>::const_iterator iter = MolList.begin();
+        iter != MolList.end();
+        ++iter) {
+      MolIdMap[(*iter)->getId()] = MolNo++;
+    }
+    const size_t MaxMol = MolNo;
+
+    // have a count per element and per molecule (0 is for all homeless atoms)
+    std::vector<int> **elementNo = new std::vector<int>*[MaxMol];
+    for (size_t i = 0; i < MaxMol; ++i)
+      elementNo[i] = new std::vector<int>(MAX_ELEMENTS,1);
     char name[MAXSTRINGSIZE];
+    std::string ResidueName;
 
     // write ATOMs
     int AtomNo = 1; // serial number starts at 1 in pdb
-    int MolNo = 1;  // residue number starts at 1 in pdb
     for (vector<atom *>::iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {
+      PdbAtomInfoContainer &atomInfo = additionalAtomData[(*atomIt)->getId()];
+      // gather info about residue
+      const molecule *mol = (*atomIt)->getMolecule();
+      if (mol == NULL) {
+        MolNo = 0;
+        atomInfo.set(PdbKey::resSeq, "0");
+      } else {
+        ASSERT(MolIdMap.find(mol->getId()) != MolIdMap.end(),
+            "PdbParser::save() - Mol id "+toString(mol->getId())+" not present despite we set it?!");
+        MolNo = MolIdMap[mol->getId()];
+        atomInfo.set(PdbKey::resSeq, toString(MolIdMap[mol->getId()]));
+        if (atomInfo.get<std::string>(PdbKey::resName) == "-")
+          atomInfo.set(PdbKey::resName, mol->getName().substr(0,3));
+      }
+      // get info about atom
       const size_t  Z = (*atomIt)->getType()->getAtomicNumber();
-      sprintf(name, "%2s%02d",(*atomIt)->getType()->getSymbol().c_str(), elementNo[Z]);
-      elementNo[Z] = (elementNo[Z]+1) % 100;   // confine to two digits
-      const molecule *mol = (*atomIt)->getMolecule();
-      if (mol == NULL) {  // for homeless atoms, MolNo = -1 is reserved
-        MolNo = -1;
-      } else {
-        MolNo = mol->getId();
+      if (atomInfo.get<std::string>(PdbKey::name) == "-") {  // if no name set, give it a new name
+        sprintf(name, "%2s%02d",(*atomIt)->getType()->getSymbol().c_str(), (*elementNo[MolNo])[Z]);
+        (*elementNo[MolNo])[Z] = ((*elementNo[MolNo])[Z]+1) % 100;   // confine to two digits
+        atomInfo.set(PdbKey::name, name);
       }
-      saveLine(file, *atomIt, name, AtomNo, MolNo);
-      setAtomId((*atomIt)->getId(), AtomNo);
+      // set position
+      for (size_t i=0; i<NDIM;++i) {
+        stringstream position;
+        position << setw(8) << fixed << setprecision(3) << (*atomIt)->getPosition().at(i);
+        atomInfo.set(PositionEnumMap[i], position.str());
+      }
+      // change element and charge if changed
+      if (atomInfo.get<std::string>(PdbKey::element) != (*atomIt)->getType()->getSymbol())
+        atomInfo.set(PdbKey::element, (*atomIt)->getType()->getSymbol());
+      setSerial((*atomIt)->getId(), AtomNo);
+      atomInfo.set(PdbKey::serial, toString(AtomNo));
+
+      // finally save the line
+      saveLine(file, atomInfo);
       AtomNo++;
     }
+    for (size_t i = 0; i < MaxMol; ++i)
+      delete elementNo[i];
+    delete elementNo;
 
     // write CONECTs
@@ -198,29 +246,55 @@
  * \param stream where to write the line to
  * \param *currentAtom the atom of which information should be written
+ * \param AtomNo serial number of atom
  * \param *name name of atom, i.e. H01
- * \param AtomNo serial number of atom
+ * \param ResidueName Name of molecule
  * \param ResidueNo number of residue
  */
-void PdbParser::saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResidueNo) {
-  *file << "ATOM ";
-  *file << setw(6) << AtomNo; /* atom serial number */
-  *file << setw(1) << " ";
-  *file << setfill(' ') << left << setw(4) << name << right;  /* atom name */
-  *file << setw(1) << " ";
-  *file << setfill(' ') << setw(3) << ((currentAtom->getMolecule() != NULL) ? currentAtom->getMolecule()->getName().substr(0,3) : "-");  /* residue name */
-  *file << setw(1) << " ";
-  *file << setfill(' ') << setw(1) << (char)('a'+(unsigned char)(AtomNo % 26)); /* letter for chain */
-  *file << setw(4) << ResidueNo; /* residue sequence number */
-  *file << setw(4) << "    ";
-  for (int i=0;i<NDIM;i++) {
-    *file << setw(8) << setprecision(3) << showpoint << currentAtom->at(i); /* positional coordinate in Angstroem */
-  }
-  *file << setw(6) << setprecision(2) << showpoint << (double)currentAtom->getType()->getValence(); /* occupancy */
-  *file << setw(6) << setprecision(2) << showpoint << (double)currentAtom->getType()->getNoValenceOrbitals(); /* temperature factor */
-  *file << noshowpoint;
-  *file << setw(6) << "      ";
-  *file << setw(4) << "0";
-  *file << setfill(' ') << setw(2) << currentAtom->getType()->getSymbol();
-  *file << setw(2) << "0";
+void PdbParser::saveLine(
+    ostream* file,
+    const PdbAtomInfoContainer &atomInfo)
+{
+  *file << setfill(' ') << left << setw(6)
+      << atomInfo.get<std::string>(PdbKey::token);
+  *file << setfill(' ') << right << setw(5)
+      << atomInfo.get<int>(PdbKey::serial); /* atom serial number */
+  *file << " "; /* char 12 is empty */
+  *file << setfill(' ') << left << setw(4)
+      << atomInfo.get<std::string>(PdbKey::name);  /* atom name */
+  *file << setfill(' ') << left << setw(1)
+      << atomInfo.get<std::string>(PdbKey::altLoc); /* alternate location/conformation */
+  *file << setfill(' ') << left << setw(3)
+      << atomInfo.get<std::string>(PdbKey::resName);  /* residue name */
+  *file << " "; /* char 21 is empty */
+  *file << setfill(' ') << left << setw(1)
+      << atomInfo.get<std::string>(PdbKey::chainID); /* chain identifier */
+  *file << setfill(' ') << left << setw(4)
+      << atomInfo.get<int>(PdbKey::resSeq); /* residue sequence number */
+  *file << setfill(' ') << left << setw(1)
+      << atomInfo.get<std::string>(PdbKey::iCode); /* iCode */
+  *file << "   "; /* char 28-30 are empty */
+  // have the following operate on stringstreams such that format specifiers
+  // only act on these
+  for (size_t i=0;i<NDIM;++i) {
+    stringstream position;
+    position << fixed << setprecision(3) << showpoint
+        << atomInfo.get<double>(PositionEnumMap[i]);
+    *file << setfill(' ') << right << setw(8) << position.str();
+  }
+  {
+    stringstream occupancy;
+    occupancy << fixed << setprecision(2) << showpoint
+        << atomInfo.get<double>(PdbKey::occupancy); /* occupancy */
+    *file << setfill(' ') << right << setw(6) << occupancy.str();
+  }
+  {
+    stringstream tempFactor;
+    tempFactor << fixed << setprecision(2) << showpoint
+        << atomInfo.get<double>(PdbKey::tempFactor); /* temperature factor */
+    *file << setfill(' ') << right << setw(6) << tempFactor.str();
+  }
+  *file << "          "; /* char 68-76 are empty */
+  *file << setfill(' ') << right << setw(2) << atomInfo.get<std::string>(PdbKey::element); /* element */
+  *file << setfill(' ') << right << setw(2) << atomInfo.get<int>(PdbKey::charge); /* charge */
 
   *file << endl;
@@ -240,8 +314,8 @@
       if (MaxNo >= MaxnumberOfNeighbors) {
         *file << "CONECT";
-        *file << setw(5) << getAtomId(currentAtom->getId());
+        *file << setw(5) << getSerial(currentAtom->getId());
         MaxNo = 0;
       }
-      *file << setw(5) << getAtomId((*currentBond)->GetOtherAtom(currentAtom)->getId());
+      *file << setw(5) << getSerial((*currentBond)->GetOtherAtom(currentAtom)->getId());
       MaxNo++;
       if (MaxNo == MaxnumberOfNeighbors)
@@ -253,5 +327,4 @@
 }
 
-
 /** Retrieves a value from PdbParser::atomIdMap.
  * \param atomid key
@@ -259,18 +332,4 @@
  */
 size_t PdbParser::getSerial(const size_t atomid) const
-{
-  ConvertTo<size_t> toSize_t;
-  ASSERT(additionalAtomData.find(atomid) != additionalAtomData.end(),
-      "PdbParser::getSerial: atomid "+toString(atomid)+" not present in Map.");
-  const PdbAtomInfoContainer &atomInfo = additionalAtomData.at(atomid);
-
-  return toSize_t(atomInfo.get(PdbKey::serial));
-}
-
-/** Retrieves a value from PdbParser::atomIdMap.
- * \param atomid key
- * \return value
- */
-size_t PdbParser::getAtomId(const size_t atomid) const
 {
   ASSERT(atomIdMap.find(atomid) != atomIdMap.end(), "PdbParser::getAtomId: atomid not present in Map.");
@@ -283,9 +342,9 @@
  * \return true - key not present, false - value present
  */
-void PdbParser::setAtomId(const size_t localatomid, const size_t atomid)
+void PdbParser::setSerial(const size_t localatomid, const size_t atomid)
 {
   pair<std::map<size_t,size_t>::iterator, bool > inserter;
-  DoLog(1) && (Log() << Verbose(1) << "PdbParser::setAtomId() - Inserting ("
-      << localatomid << " -> " << atomid << ")." << std::endl);
+//  DoLog(1) && (Log() << Verbose(1) << "PdbParser::setAtomId() - Inserting ("
+//      << localatomid << " -> " << atomid << ")." << std::endl);
   inserter = atomIdMap.insert( make_pair(localatomid, atomid) );
   ASSERT(inserter.second, "PdbParser::setAtomId: atomId already present in Map.");
@@ -314,10 +373,11 @@
 
   lineStream << line;
+  atomInfo.set(PdbKey::token, line.substr(0,6));
   atomInfo.set(PdbKey::serial, line.substr(6,5));
   std::pair< std::set<size_t>::const_iterator, bool> Inserter =
-    SerialSet.insert(toSize_t(atomInfo.get(PdbKey::serial)));
+    SerialSet.insert(toSize_t(atomInfo.get<std::string>(PdbKey::serial)));
   ASSERT(Inserter.second,
       "PdbParser::readAtomDataLine() - ATOM contains entry with serial "
-      +atomInfo.get(PdbKey::serial)+" already present!");
+      +atomInfo.get<std::string>(PdbKey::serial)+" already present!");
   // assign hightest+1 instead, but then beware of CONECT entries! Another map needed!
 //  if (!Inserter.second) {
@@ -326,5 +386,5 @@
 //    atomInfo.set(PdbKey::serial, toString(id));
 //    DoeLog(2) && (eLog() << Verbose(2)
-//        << "Serial " << atomInfo.get(PdbKey::serial) << " already present, "
+//        << "Serial " << atomInfo.get<std::string>(PdbKey::serial) << " already present, "
 //        << "assigning " << toString(id) << " instead." << std::endl);
 //  }
@@ -348,7 +408,7 @@
 //      << line.substr(78,2) << std::endl);
 
-  setAtomId(toSize_t(atomInfo.get(PdbKey::serial)), newAtom->getId());
+  setSerial(toSize_t(atomInfo.get<std::string>(PdbKey::serial)), newAtom->getId());
   atomInfo.set(PdbKey::name, line.substr(12,4));
-  atomInfo.set(PdbKey::altloc, line.substr(16,1));
+  atomInfo.set(PdbKey::altLoc, line.substr(16,1));
   atomInfo.set(PdbKey::resName, line.substr(17,3));
   atomInfo.set(PdbKey::chainID, line.substr(21,1));
@@ -364,6 +424,10 @@
   atomInfo.set(PdbKey::tempFactor, line.substr(60,6));
   atomInfo.set(PdbKey::charge, line.substr(78,2));
-  PdbAtomInfoContainer::ScanKey(word, line.substr(76,2));
-  newAtom->setType(World::getInstance().getPeriode()->FindElement(word));
+  atomInfo.set(PdbKey::element, line.substr(76,2));
+  const element *elem = World::getInstance().getPeriode()
+      ->FindElement(atomInfo.get<std::string>(PdbKey::element));
+  ASSERT(elem != NULL,
+      "PdbParser::readAtomDataLine() - element "+atomInfo.get<std::string>(PdbKey::element)+" is unknown!");
+  newAtom->setType(elem);
 
   if (newmol != NULL)
@@ -381,16 +445,19 @@
 
   DoLog(1) && (Log() << Verbose(1) << "We know about atom " << newAtom->getId() << ":" << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tserial is " << atomInfo.get(PdbKey::serial) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tname is " << atomInfo.get(PdbKey::name) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\taltloc is " << atomInfo.get(PdbKey::altloc) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tresName is " << atomInfo.get(PdbKey::resName) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tchainID is " << atomInfo.get(PdbKey::chainID) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tresSeq is " << atomInfo.get(PdbKey::resSeq) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tiCode is " << atomInfo.get(PdbKey::iCode) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tx is " << newAtom->getPosition() << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\toccupancy is " << atomInfo.get(PdbKey::occupancy) << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\ttempFactor is " << atomInfo.get(PdbKey::tempFactor) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\ttoken is " << atomInfo.get<std::string>(PdbKey::token) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tserial is " << atomInfo.get<int>(PdbKey::serial) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tname is " << atomInfo.get<std::string>(PdbKey::name) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\taltLoc is " << atomInfo.get<std::string>(PdbKey::altLoc) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tresName is " << atomInfo.get<std::string>(PdbKey::resName) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tchainID is " << atomInfo.get<std::string>(PdbKey::chainID) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tresSeq is " << atomInfo.get<int>(PdbKey::resSeq) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tiCode is " << atomInfo.get<std::string>(PdbKey::iCode) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tX is " << atomInfo.get<double>(PdbKey::X) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tY is " << atomInfo.get<double>(PdbKey::Y) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tZ is " << atomInfo.get<double>(PdbKey::Z) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\toccupancy is " << atomInfo.get<double>(PdbKey::occupancy) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\ttempFactor is " << atomInfo.get<double>(PdbKey::tempFactor) << std::endl);
   DoLog(1) && (Log() << Verbose(1) << "\telement is '" << *(newAtom->getType()) << "'" << std::endl);
-  DoLog(1) && (Log() << Verbose(1) << "\tcharge is " << atomInfo.get(PdbKey::charge) << std::endl);
+  DoLog(1) && (Log() << Verbose(1) << "\tcharge is " << atomInfo.get<int>(PdbKey::charge) << std::endl);
 }
 
@@ -426,10 +493,10 @@
 
   // add neighbours
-  atom *_atom = World::getInstance().getAtom(AtomById(getAtomId(id)));
+  atom *_atom = World::getInstance().getAtom(AtomById(getSerial(id)));
   for (std::list<size_t>::const_iterator iter = ListOfNeighbors.begin();
       iter != ListOfNeighbors.end();
       ++iter) {
 //    DoLog(1) && (Log() << Verbose(1) << "Adding Bond (" << getAtomId(id) << "," << getAtomId(*iter) << ")" << std::endl);
-    atom * const _Otheratom = World::getInstance().getAtom(AtomById(getAtomId(*iter)));
+    atom * const _Otheratom = World::getInstance().getAtom(AtomById(getSerial(*iter)));
     _atom->addBond(_Otheratom);
   }
@@ -478,23 +545,23 @@
       const PdbAtomInfoContainer &OtheratomInfo = b.additionalAtomData.at((*iter)->getId());
 
-      status = status && (atomInfo.get(PdbKey::serial) == OtheratomInfo.get(PdbKey::serial));
+      status = status && (atomInfo.get<std::string>(PdbKey::serial) == OtheratomInfo.get<std::string>(PdbKey::serial));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in serials!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::name) == OtheratomInfo.get(PdbKey::name));
+      status = status && (atomInfo.get<std::string>(PdbKey::name) == OtheratomInfo.get<std::string>(PdbKey::name));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in names!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::altloc) == OtheratomInfo.get(PdbKey::altloc));
-      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in altlocs!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::resName) == OtheratomInfo.get(PdbKey::resName));
+      status = status && (atomInfo.get<std::string>(PdbKey::altLoc) == OtheratomInfo.get<std::string>(PdbKey::altLoc));
+      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in altLocs!" << std::endl);
+      status = status && (atomInfo.get<std::string>(PdbKey::resName) == OtheratomInfo.get<std::string>(PdbKey::resName));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in resNames!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::chainID) == OtheratomInfo.get(PdbKey::chainID));
+      status = status && (atomInfo.get<std::string>(PdbKey::chainID) == OtheratomInfo.get<std::string>(PdbKey::chainID));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in chainIDs!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::resSeq) == OtheratomInfo.get(PdbKey::resSeq));
+      status = status && (atomInfo.get<std::string>(PdbKey::resSeq) == OtheratomInfo.get<std::string>(PdbKey::resSeq));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in resSeqs!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::iCode) == OtheratomInfo.get(PdbKey::iCode));
+      status = status && (atomInfo.get<std::string>(PdbKey::iCode) == OtheratomInfo.get<std::string>(PdbKey::iCode));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in iCodes!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::occupancy) == OtheratomInfo.get(PdbKey::occupancy));
+      status = status && (atomInfo.get<std::string>(PdbKey::occupancy) == OtheratomInfo.get<std::string>(PdbKey::occupancy));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in occupancies!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::tempFactor) == OtheratomInfo.get(PdbKey::tempFactor));
+      status = status && (atomInfo.get<std::string>(PdbKey::tempFactor) == OtheratomInfo.get<std::string>(PdbKey::tempFactor));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in tempFactors!" << std::endl);
-      status = status && (atomInfo.get(PdbKey::charge) == OtheratomInfo.get(PdbKey::charge));
+      status = status && (atomInfo.get<std::string>(PdbKey::charge) == OtheratomInfo.get<std::string>(PdbKey::charge));
       if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in charges!" << std::endl);
     }
Index: src/Parser/PdbParser.hpp
===================================================================
--- src/Parser/PdbParser.hpp	(revision 24f1282e1df2c72138841c78643facb494f0b9ed)
+++ src/Parser/PdbParser.hpp	(revision 16462f8c5b097f56fd1c2c03e31b5cd9daef6a0f)
@@ -38,10 +38,14 @@
   bool isUsedField(std::string fieldName);
   void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);
-  void saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResdueNo);
+  void saveLine(ostream* file, const PdbAtomInfoContainer &atomInfo);
 
   // internal getter and setter
   size_t getSerial(const size_t atomid) const;
-  size_t getAtomId(const size_t atomid) const;
-  void setAtomId(const size_t localatomid, const size_t atomid);
+  void setSerial(const size_t localatomid, const size_t atomid);
+
+  /**
+   * argh, why can't just PdbKey::X+(size_t)i
+   */
+  std::map<size_t, PdbKey::PdbDataKey> PositionEnumMap;
 
   /**
