Refactored some functions in 'location' spec.