enhanced calculations using two dimensional arrays, added error in approx