Improved EFX remapping code to remove the ugly 2-pass solution