refactor view as a new class