Refactored file logic and directory details out of respository layer.