added support for multiple graphs