refactored for view class