Move graph script into external file