modified optional header function to differentiate between different executable types