added error calculations