added ilsq and a number of the required C functions