refactor location.rb