added checks for directory rules. need to move to an OOP methodology