refactoring type hierachy of graph commands