Optimize behaviors and livequery for speed.