Remove duplication in Rack helpers