Moved out the view part to a separate class.