Integration of Improper Rational Functions