Refactor handleLocation a bit.