updating q to g