added logic for various combinations of profiles and or rules files