Simplified linear equation solver. This stopped the floating point errors