Refactor directory routes loader