Given the desire to retain backward compatibility, I am not sure how to simplify this logic further.