First working version of 1d linear regression