cleaned up linear regression