Refactor Axiom query