Adding error calculation