implemented DirContents class for modularity
same as before