filesystem functions refactored.