Cleaned up code and added plotting for integrand