made linear reg.orders of magnitude more efficient