Finished first graph imp, ported RIFS code.