Almost finished grahams alg