Redesign to use AbstractQuery