fixed some bugs, but i don't think chaotic approach will work. i think it has to be gradient descent instead.