Refactored a little bit of the location trigger.