refactoring + graph output for model relationships