finished on this branch barring verification of output for endogenous library