Modified logic for refining location