Refactored main view class