First implementation with dir