added directory walking and parsing function