refrence global q and G correctly