linear predictors function added, main script shrunk