try to make the gfx funtion seperatly.