does DIRECTORY? work here. would simplify it significantly