Bug fixes. First functioning version with yhat.