Better implementation of n_prime