refactored manage directory size