refactoring key handling for redhat variants.