refactored views to classes from functions