Refactoring for pydot