Modified to work with latest GFX. Untested.