Created base view class and consolidated duplicated logic