Refactor query projection