some code refactored out to backend.py
added parent handling for both File and Directory