Fixed some indexing problems, dividing by zero problems

Alternative linear method now works, preserves linear solutions!
(Tested!)