A bit of refactoring. File\directory finding finally works..