refactored the dir struct