Adding dir parameter
Adding function isInSubDirectory