Refactor: simplify some functions
Currently flake8 reports the following functions which are too complex:
![изображение](https://user-images.githubusercontent.com/39452697/90312454-43021400-df0d-11ea-80ac-ae75c9799257.png)
It would be good to refactor those functions into multiple smaller ones, especially `model_view`.