fixed up that alg4