Added the error calculation