linear regression working, need to refactor