Refactor - extract commitFile function
Implement view and edit roles. Refactored existing code