cleaned up linear solver code
harmonized reformatting