setup gd so that it can save and resume without losing state