Added some logic in the view.