Added squareLoss function