Refactor code for registering unary ufuncs