Fixed some algorithms
Much better