clean up brent's xgcd