Text this: Mid-point technique for calculating divergent integrals