adding the error function implementation.