refactor of locator code