Refactor views to use class view pattern