added partial pivoting