Gfx to buffers and purging code