Refactor location code so it is cleaner.