made parsing the directory dynamic