Use quotient/remainder in bezout

Use quotient/remainder in bezout. This is much more efficient.
(cherry picked from commit 6b5e4c90e40466c4b78a71919eb5274772044f11)