Initial commit from psi_rng/c