Refactor code for registering binary ufuncs