refactoring graph transformations and adding test class