better dir parsing