refactored into View class