refactoring to support FAT binaries