Updates to g function