refactor code in application.html.erb