quadratic error implemented (not tested yet)