Cleanup, normalize and fix gfx code.