starting chi squared code