Moved remaining functions out of mapping function, moved mapping function out of locator function