Refactor view shared file, move diff to file.py