Switch query generatoin to archetype query
#2