Separated graph logic out into separate templates