Refactor Target Query and Target