Renamed vars and fixed G output