Made extensive modifications to linear regression code and get a semi working version now