moving code to application_helper, adding helper to pages and section view