Updated kgraph functions