clean up math.Big usage, thanks @agl
add comments and mark some problem spots