Refactored Query, Added Query::applyToSpawn(), reduce code duplication