Rewritten G2P code