Minimizing the error