First draft of graph function