refactor some code in TasksController and views/list/show.html.erb