extracted method for going up directory tree and purging empty directories
simplified 'add' method
simplified removing and listing of files