this should be named linearRegImpl