Added View class and moved view logic to view class