gfx cleanup and optimization