added linear regression, refactored the code