cg3: move initialisation from realizefn to initfn