framework for gmaga taken from sample code