moves logic to the view