Cleaned up the code. init_integrals still takes ages to run