Tested and fixed h_integrate