Why does this need the "if y is not binary" case? It seems to make things too complex.