refactor and split location