Move directory linking method to a separate class