Made directory loading re-useable