Code refactor in site.rb