refactor to class-based views