cleaned some code in views.py