Index: src/Actions/GraphAction/CreateAdjacencyAction.cpp
===================================================================
--- src/Actions/GraphAction/CreateAdjacencyAction.cpp	(revision 4f54b36ce118b509a6b2b0778e1a561a9cb1d0d9)
+++ src/Actions/GraphAction/CreateAdjacencyAction.cpp	(revision 055ad7d1ba1b8d09c8c3cf8f1dfdf2b27859c787)
@@ -35,4 +35,5 @@
 #include "CodePatterns/MemDebug.hpp"
 
+#include "CodePatterns/Assert.hpp"
 #include "CodePatterns/Log.hpp"
 
@@ -50,4 +51,11 @@
 using namespace MoleCuilder;
 
+// Storing undo state
+struct BondInfo_t {
+  atomId_t leftatom;
+  atomId_t rightatom;
+  size_t degree;
+};
+
 // and construct the stuff
 #include "CreateAdjacencyAction.def"
@@ -58,7 +66,45 @@
   ASSERT(BG != NULL, "GraphCreateAdjacencyAction: BondGraph is NULL.");
 
+  // count all present bonds
   World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection());
+  std::vector<BondInfo_t> bonds;
+  {
+    size_t count_bonds = 0;
+    for (World::AtomComposite::const_iterator iter = Set.begin();
+        iter != Set.end();
+        ++iter) {
+      const atom * const Walker = *iter;
+      count_bonds += Walker->getListOfBonds().size();
+    }
+    bonds.reserve(count_bonds/2);
+  }
+  // Storing undo info
+  for (World::AtomComposite::const_iterator iter = Set.begin();
+      iter != Set.end();
+      ++iter) {
+    const atom * const Walker = *iter;
+    const BondList& ListOfBonds = Walker->getListOfBonds();
+    for (BondList::const_iterator bonditer = ListOfBonds.begin();
+        bonditer != ListOfBonds.end();
+        ++bonditer) {
+      const bond::ptr &CurrentBond = *bonditer;
+      // if both atoms are in selected set, we check ids otherwise not
+      if (((!World::getInstance().isSelected(CurrentBond->leftatom))
+          || (!World::getInstance().isSelected(CurrentBond->rightatom)))
+          || (CurrentBond->leftatom->getId() < CurrentBond->rightatom->getId())) {
+        BondInfo_t BondInfo;
+        BondInfo.leftatom = CurrentBond->leftatom->getId();
+        BondInfo.rightatom = CurrentBond->rightatom->getId();
+        BondInfo.degree = CurrentBond->BondDegree;
+        bonds.push_back(BondInfo);
+      }
+    }
+  }
+  GraphCreateAdjacencyState *UndoState = new GraphCreateAdjacencyState(bonds, params);
+
+  // now recreate adjacency
   BG->CreateAdjacency(Set);
 
+  // give info
   size_t BondCount = 0;
   std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
@@ -68,23 +114,51 @@
   LOG(0, "STATUS: Recognized " << BondCount << " bonds.");
 
-  return Action::success;
+  return Action::state_ptr(UndoState);
 }
 
 Action::state_ptr GraphCreateAdjacencyAction::performUndo(Action::state_ptr _state) {
-//  GraphCreateAdjacencyState *state = assert_cast<GraphCreateAdjacencyState*>(_state.get());
+  GraphCreateAdjacencyState *state = assert_cast<GraphCreateAdjacencyState*>(_state.get());
 
-  return Action::success;
+  BondGraph *BG = World::getInstance().getBondGraph();
+  ASSERT(BG != NULL, "GraphCreateAdjacencyAction: BondGraph is NULL.");
+
+  // remove all bonds in the set
+  World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection());
+  BG->cleanAdjacencyList(Set);
+
+  // recreate from stored info
+  const size_t CurrentTime = WorldTime::getTime();
+  std::vector<BondInfo_t> &bonds = state->bonds;
+  for(std::vector<BondInfo_t>::const_iterator iter = bonds.begin();
+      iter != bonds.end(); ++iter) {
+    atom * const Walker = World::getInstance().getAtom(AtomById(iter->leftatom));
+    ASSERT( Walker != NULL,
+        "GraphCreateAdjacencyAction::performUndo() - "+toString(iter->leftatom)+" missing.");
+    atom * const OtherWalker = World::getInstance().getAtom(AtomById(iter->rightatom));
+    ASSERT( OtherWalker != NULL,
+        "GraphCreateAdjacencyAction::performUndo() - "+toString(iter->rightatom)+" missing.");
+    bond::ptr CurrentBond = Walker->addBond(CurrentTime, OtherWalker);
+    CurrentBond->BondDegree = iter->degree;
+  }
+  return Action::state_ptr(_state);
 }
 
 Action::state_ptr GraphCreateAdjacencyAction::performRedo(Action::state_ptr _state){
-  return Action::success;
+  BondGraph *BG = World::getInstance().getBondGraph();
+  ASSERT(BG != NULL, "GraphCreateAdjacencyAction: BondGraph is NULL.");
+
+  // now recreate adjacency
+  World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection());
+  BG->CreateAdjacency(Set);
+
+  return Action::state_ptr(_state);
 }
 
 bool GraphCreateAdjacencyAction::canUndo() {
-  return false;
+  return true;
 }
 
 bool GraphCreateAdjacencyAction::shouldUndo() {
-  return false;
+  return true;
 }
 /** =========== end of function ====================== */
Index: src/Actions/GraphAction/CreateAdjacencyAction.def
===================================================================
--- src/Actions/GraphAction/CreateAdjacencyAction.def	(revision 4f54b36ce118b509a6b2b0778e1a561a9cb1d0d9)
+++ src/Actions/GraphAction/CreateAdjacencyAction.def	(revision 055ad7d1ba1b8d09c8c3cf8f1dfdf2b27859c787)
@@ -7,7 +7,8 @@
 
 // all includes and forward declarations necessary for non-integral types below
+#include <vector>
+#include "types.hpp"
 
-
-#include "Parameters/Validators/DummyValidator.hpp"
+struct BondInfo_t;
 
 // i.e. there is an integer with variable name Z that can be found in
@@ -21,6 +22,6 @@
 #undef paramvalids
 
-#undef statetypes
-#undef statereferences
+#define statetypes (std::vector<BondInfo_t>)
+#define statereferences (bonds)
 
 // some defines for all the names, you may use ACTION, STATE and PARAMS
