Add binary factorization function