move code from view to show