refactoring graphcontroller