Replaced function based views with class-based views. TODO: upgrade all views to CBV