Added all of the logic to the view controller