tidied up views.py