Code refactoring: views.py is finally cleaned up.