start of new error algorithm